<template>
  <div>
    <TopFilter :list="partSellList" :cols="3" :labelWidth="90" @filterChange="changeHandle"></TopFilter>
    <FilterTable
      ref="partTable"
      :columns="partSellColumns"
      :isSelectColumn="false"
      :dataSource="listResult"
      :datakey="'rows'"
      :onColumnsChange="columns => this.partSellColumns = columns"
    >
      <template slot="controls">
        <el-button size="small" type="primary">导出</el-button>
      </template>
    </FilterTable>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
export default {
  name: 'partSell',
  mixins: [dictionary],
  data() {
    this.BaseTable = null;
    return {
      listResult:[],
      partSellList: this.createPartInfoFilterList(),
      // fetchApi:'',
      // fetchParams: { xhrAbort: false },
      partSellColumns: this.createPartColumns()
    };
  },

 methods: {
    createPartInfoFilterList() {
      return [
       {
        type: 'DATE',
        label: '会计年月',
        fieldName: 'funcYearMonth',
        valueFormat: 'yyyy-MM-dd'
       }
      ];
    },
    createPartColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '仓库',
          dataIndex: 'STORAGE_CODE',
          sorter: true
        },
        {
          title: '期初金额',
          dataIndex: 'OPEN_AMOUNT',
          sorter: true
        },
        {
          title: '期末金额',
          dataIndex: 'CLOSE_AMOUNT',
          sorter: true
        },
        {
          title: '入库金额',
          dataIndex: 'STOCK_IN_AMOUNT',
          sorter: true
        },
        {
          title: '移库入库金额',
          dataIndex: 'TRANSFER_IN_AMOUNT',
          sorter: true
        },
        {
          title: '出库成本金额',
          dataIndex: 'STOCK_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '出库金额',
          dataIndex: 'OUT_AMOUNT',
          sorter: true
        },
        {
          title: '移库出库金额',
          dataIndex: 'TRANSFER_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '采购入库金额',
          dataIndex: 'BUY_IN_AMOUNT',
          sorter: true
        },
        {
          title: '调拨入库金额',
          dataIndex: 'ALLOCATE_IN_AMOUNT',
          sorter: true
        },
        {
          title: '其它入库金额',
          dataIndex: 'OTHER_IN_AMOUNT',
          sorter: true
        },
        {
          title: '报溢入库金额',
          dataIndex: 'PROFIT_IN_AMOUNT',
          sorter: true
        },
        {
          title: '维修领料成本金额',
          dataIndex: 'REPAIR_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '配件销售成本金额',
          dataIndex: 'SALE_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '配件销售销售金额',
          dataIndex: 'SALE_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '内部领用销售金额',
          dataIndex: 'INNER_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '内部领用成本金额',
          dataIndex: 'INNER_OUT_COST_AMOUNT',
          sorter: true
        },
         {
          title: '调拨出库成本金额',
          dataIndex: 'ALLOCATE_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '调拨出库销售金额',
          dataIndex: 'ALLOCATE_OUT_SALE_AMOUNT',
          sorter: true
        },
       {
          title: '其它出库成本金额',
          dataIndex: 'OTHER_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '发料调整差异金额',
          dataIndex: 'OTHER_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '报损出库金额',
          dataIndex: 'LOSS_OUT_AMOUNT',
          sorter: true
        },
        {
          title: '维修领料销售金额',
          dataIndex: 'REPAIR_OUT_SALE_AMOUNT',
          sorter: true
        },
        {
          title: '不含移库的入库金额',
          dataIndex: 'IN_MONEY',
          sorter: true,
           render: props => {
            return <span>{(props.row.STOCK_IN_AMOUNT  - props.row.TRANSFER_IN_AMOUNT)}</span>;
          }
        },
        {
          title: '不含移库的出库金额',
          dataIndex: 'OUT_MONEY',
          sorter: true,
           render: props => {
            return <span>{(props.row.OUT_AMOUNT  - props.row.TRANSFER_OUT_COST_AMOUNT)}</span>;
          }
        },
        {
          title: '不含移库出库成本金额',
          dataIndex: 'NOT_TRAN_OUT_COST_AMOUNT',
          sorter: true,
           render: props => {
            return <span>{(props.row.STOCK_OUT_COST_AMOUNT  - props.row.TRANSFER_OUT_COST_AMOUNT)}</span>;
          }
        },
        {
          title: '装潢领料成本金额',
          dataIndex: 'UPHOLSTER_OUT_COST_AMOUNT',
          sorter: true
        },
        {
          title: '装潢领料销售金额',
          dataIndex: 'UPHOLSTER_OUT_SALE_AMOUNT',
          sorter: true
        }
      ];
    },
    changeHandle(val) {
      console.log('val', val);
      this.fetchParams = Object.assign({}, val, { xhrAbort: false });
    }
  },
  mounted() {
    this.BaseTable = this.$refs.partTable.$refs.pageTable;
    let aa={
      STORAGE_CODE:"OEM库",
      OPEN_AMOUNT:48814.83,
      CLOSE_AMOUNT:47187.67,
      STOCK_IN_AMOUNT:0.00,
      TRANSFER_IN_AMOUNT:0.00,
      STOCK_OUT_COST_AMOUNT:1627.16	,
      OUT_AMOUNT:5729.90,
      TRANSFER_OUT_COST_AMOUNT:0.00,
      BUY_IN_AMOUNT:0.00,
      ALLOCATE_IN_AMOUNT:0.00,
      OTHER_IN_AMOUNT:0.00,
      PROFIT_IN_AMOUNT:0.00,
      REPAIR_OUT_COST_AMOUNT:1627.16,
      SALE_OUT_COST_AMOUNT:0.00,
      SALE_OUT_SALE_AMOUNT:0.00,
      INNER_OUT_SALE_AMOUNT:0.00,
      INNER_OUT_COST_AMOUNT:0.00,
      ALLOCATE_OUT_COST_AMOUNT:17.98,
      ALLOCATE_OUT_SALE_AMOUNT:109.23,
      OTHER_OUT_COST_AMOUNT:2891.92,
      OTHER_OUT_SALE_AMOUNT:2231.92,
      LOSS_OUT_AMOUNT:13.23,
      REPAIR_OUT_SALE_AMOUNT:3289.01,
      // IN_MONEY
      // OUT_MONEY
      // NOT_TRAN_OUT_COST_AMOUNT:
      UPHOLSTER_OUT_COST_AMOUNT:13.00,
      UPHOLSTER_OUT_SALE_AMOUNT:0.00
    }
  this.listResult=[aa];
    

  }
};
</script>

<style scoped lang="less">

</style>
